def addOne(list: List[Int]): Unit = {
  val l = list.map(_ + 1)
  println(l)
}

def filterEven(list: List[Int]): Unit = {
  // for (i <-list){
  //     if (x%2!=0){
  //         list-=i
  //     }
  // }
  val l = list.filter(_ % 2 == 0)
  println(l)
}

def mapReduce(
    list: List[Int],
    flat: Int => Int,
    re: (Int, Int) => Int
): Unit = {
  val l = list.map(flat).reduce(re)
  println(l)
}

val list = List(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
val a = addOne(list)
val f = filterEven(list)
val m = mapReduce(list, x => x * 2, _ + _)
